#include "app_buffer.h"
#include "log.h"
#include "string.h"

int main(int argc, char const *argv[])
{
    //1  初始化缓冲区
    app_buffer_t *buffer= app_buffer_init();
    
    //2 写入 1 
    char  data1[15] = "hello world123";

    app_buffer_write(buffer,data1, strlen(data1));

    //3 写入2 
    char data2[18] = "hello atguigu78910";

    app_buffer_write(buffer,data2, strlen(data2));

    //4 读取 
    char data_buff1[100];
    int data_len1= app_buffer_read(buffer,data_buff1, 100);
    printf(" data1 = %.*s\n",data_len1,data_buff1);

    char data_buff2[100];
    int data_len2= app_buffer_read(buffer,data_buff2, 100);
    printf(" data2 = %.*s\n",data_len2,data_buff2);

    return 0;
}
